package com.back.mapper;


import com.back.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserDao {
    //添加
    @Insert("insert into user values(null,#{name},#{pwd},#{phone},#{email})")
    void add(User user);


    //登录
    @Select("select * from user where name = #{name} and pwd = #{pwd}")
    User login(@Param("name") String username, @Param("pwd")String pwd);

    //按UserID查询
    @Select("select * from user where id = #{id}")
    User queryById(int id);
}
